import { defineComponent } from 'vue'
import { NModal } from 'naive-ui'

const DDLModal = defineComponent({
  name: 'DDLModal',
  props: {
    showModal: {
      type: Boolean,
      default: false
    },
    ddl: {
      type: String,
      required: true
    }
  },
  emits: ['modalShowChange'],
  methods: {
    onCloseClick() {
      this.$emit('modalShowChange', false)
    }
  },
  render() {
    return (
      <NModal
        show={this.showModal}
        mask-closable={false}
        style='width: 400px'
        title={window.$t('dataManage.createTableDDL')}
        bordered={false}
        size='huge'
        preset='dialog'
        onClose={this.onCloseClick}
      >
        <p style='white-space: pre-wrap'>{this.ddl}</p>
      </NModal>
    )
  }
})

export default DDLModal
